<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let url = 'http://www.baidu.com?name=zs&age=18&gender=男'
      let arr = url.split('?')
      let str2 = arr[1]
      let arr2 = str2.split('&')
      console.log(arr2)
      let arr3 = arr2.map(function (item) {
        return item.split('=')
      })
      let obj = {}
      arr3.forEach((item) => {
        obj[item[0]] = item[1]
      })
      console.log(obj)
    </script>
</body>
</html>